{extend name="base" /}
{block name="css"}
{css href="__CSS__/flow.css" /}
{/block}
{block name="body"}
<!-- 主要内容 开始 -->
<div id="tab3" class="weui-tab__bd-item">
  <header class="weui-navBar weui-navBar-fixed">
    <a href="javascript:history.go(-1);" class="weui-navBar-item">
        <i class="icon iconfont icon-fanhui"></i>
    </a>
    <div class="weui-center">
        <span class="weui-center-title">购物车</span>
    </div>
    <a href="javascript:;" class="weui-navBar-item">
    </a>
  </header>
  <div class="weui-cells">
    <div class="weui-cell">
      <div class="weui-cell__hd">
        <span class="icon iconfont icon-dingweidizhi"></span>
      </div>
      <div class="weui-cell__bd">
        <p class="name">收货人</p>
        <p class="addr">收货地址</p>
      </div>
      <div class="weui-cell__ft" style="display: none;">
        <p class="weui-btn weui-btn_mini weui-btn_default">同步地址</p>
      </div>
    </div>
  </div>
  <div class="weui-form-preview">
    <div class="weui-form-preview__hd">
      <label class="weui-form-preview__label">付款金额</label>
      <em class="weui-form-preview__value">¥2400.00</em>
    </div>
    <div class="weui-form-preview__bd">
      <div class="weui-form-preview__item">
        <label class="weui-form-preview__label">商品</label>
        <span class="weui-form-preview__value">电动打蛋机</span>
      </div>
      <div class="weui-form-preview__item">
        <label class="weui-form-preview__label">标题标题</label>
        <span class="weui-form-preview__value">名字名字名字</span>
      </div>
      <div class="weui-form-preview__item">
        <label class="weui-form-preview__label">标题标题</label>
        <span class="weui-form-preview__value">很长很长的名字很长很长的名字</span>
      </div>
    </div>
    <div class="weui-form-preview__ft">
      <button class="weui-form-preview__btn weui-form-preview__btn_default" data-url="789" href="javascript:">取消订单</button>
      <button class="weui-form-preview__btn weui-form-preview__btn_primary" data-url="456" href="javascript:">立即付款</button>
    </div>
  </div>
  <div class="divHeight"></div>
</div>
<!-- 主要内容 结束 -->
{/block}
{block name="js"}
<script type="text/javascript">
  $(function () {
    $(document).on("click", ".weui-form-preview__btn_primary", function() {
      var url = $(this).data('url');
      $.modal({
        title: '电动打蛋机',
        text: url,
        buttons: [
          { text: "支付宝", onClick: function(){ $.toast("支付宝支付"); } },
          { text: "微信支付", onClick: function(){ $.toast("微信支付"); } },
          { text: "取消", className: "default"},
        ]
      });
    })
    .on("click", ".weui-form-preview__btn_default", function() {
      var url = $(this).data('url');
      $.confirm("您确定取消【"+url+"】订单吗?", "确认取消?", function() {
        $.toast(url+"取消订单成功!",'cancel');
      }, function() {
        //取消操作
        $.toast("不取消了!");
      });
    });
    is_weixin() && $('.weui-cell__ft').show();
    $('.name,.weui-cell__ft').click(function(){
    if(is_weixin()){
        wx.config({
          appId: '{$info.appId|default=''}',
          timestamp: {$info.timestamp|default=0},
          nonceStr: '{$info.nonceStr|default=''}',
          signature: '{$info.signature|default=''}',
          jsApiList: ['checkJsApi','scanQRCode']
        });
        wx.openAddress({
          success: function (res) {
            $('.name').html(res.userName+' '+res.telNumber);
            $('.addr').html(res.provinceName+' '+res.cityName+' '+res.countryName+' '+res.detailInfo);
            $('.weui-cell__ft').html('');
          }
        });
      }
    })
  });
</script>
{/block}